package com.flashextended.apps.logomaker.view.windows.previewlogo
{
	import com.flashextended.apps.logomaker.singleton.AppLocales;
	import com.flashextended.utils.graphics.windows.GenericInfoWindow;
	
	import flash.display.Bitmap;
	import flash.events.MouseEvent;
	
	import mx.controls.Label;
	import mx.core.UIComponent;
	import mx.events.EffectEvent;
	import mx.managers.PopUpManager;

	public class PreviewLogoW extends GenericInfoWindow
	{
		public function PreviewLogoW(w:Number, h:Number, bmp:Bitmap=null, title:String="Info")
		{
			super(w, h, title);
			displayLogo(bmp);
		}
		
		public function displayLogo(bmp:Bitmap=null):void
		{
			this.getFooter().removeChild(getCancelButton());
			if(bmp!=null)
			{
				var ui:UIComponent = new UIComponent();
				ui.width = bmp.width;
				ui.height = bmp.height;
				ui.addChild(bmp);
				this.getContentPane().addChild(ui);
			}
			else
			{
				var l:Label = new Label();
				l.text = AppLocales.getInstance().data.locales['errorPreview'];
				this.getContentPane().addChild(l);
			}
		}
		
		override public function okMouseHandler(e:MouseEvent):void
		{
			cancelMouseHandler();
		}
		
		override public function closeWindow(e:EffectEvent=null):void
		{
			PopUpManager.removePopUp(this);
		}
		
	}
}